Assignemnt #92 and 92nd program

Code

///Name: Derrick Andreasen
///Period: 7
///Program name: 92nd Program
///File name: Ninty2prog.java
///Date Finished:2/8/2016

public class Ninty2prog
{
	public static void main( String[] args )
	{
		double a;
		
		a = triangleArea(3, 3, 3);
		System.out.println("A triangle with sides 3,3,3 has an area of " + a );

		a = triangleArea(3, 4, 5);
		System.out.println("A triangle with sides 3,4,5 has an area of " + a );
 
		a = triangleArea(7, 8, 9);
		System.out.println("A triangle with sides 7,8,9 has an area of " + a );

		System.out.println("A triangle with sides 5,12,13 has an area of " + triangleArea(5, 12, 13) );
		System.out.println("A triangle with sides 10,9,11 has an area of " + triangleArea(10, 9, 11) );
		System.out.println("A triangle with sides 8,15,17 has an area of " + triangleArea(8, 15, 17) );
      System.out.println("A triangle with sides 9,9,9 has an area of " + triangleArea(9, 9, 9) );
	}
 
	public static double triangleArea( int a, int b, int c )
	{
		// the code in this method computes the area of a triangle whose sides have lengths a, b, and c
		double s, A;

		s = (a+b+c) / 2.0;
		A = Math.sqrt( s*(s-a)*(s-b)*(s-c) );

		return A;
		// ^ after computing the area, "return" it
	}
}

//HeronsFormula produces more outputs than HeronsFormulaNoMethod.
//HeronsFormula is 29 lines long, including the spaces between lines of code, and 23 lines not including those spaces. HeronsFormulaNoMethod is 60 lines long, including the spaces, and 54 lines without the spaces.
//It was easier to fix the bug on the HeronsFormula that uses the method.
//I added the new method call under the other method calls.

    

Picture of the output

Assignment 92